package standard;

import standard.util.MysqlTypeEnum;

/**
 * Create by Lingo
 */

public class ColumnInfo {
    private String name;
    private String remark;
    private String mybatisTypeName;
    private String javaClassName;
    private int isPrimary;
    private int jdbcTypeInt;
    private int isNullable;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getMybatisTypeName() {
        return mybatisTypeName;
    }

//    public void setMybatisTypeName(String mybatisTypeName) {
//        this.mybatisTypeName = mybatisTypeName;
//    }

    public String getJavaClassName() {
        return javaClassName;
    }

    public void setJavaClassName(String javaClassName) {
        String resultClassName = javaClassName.substring(0);
        //mysql中的int 类型表达范围 = java中的Integer类型
        if (javaClassName.equals("java.lang.Long")){
            resultClassName = "java.lang.Integer";
        }
        if (javaClassName.contains("Timestamp")){
            resultClassName = "java.util.Date";
        }
        this.javaClassName = resultClassName;
    }

    public int getIsPrimary() {
        return isPrimary;
    }

    public void setIsPrimary(int isPrimary) {
        this.isPrimary = isPrimary;
    }

    public int getJdbcTypeInt() {
        return jdbcTypeInt;
    }

    public void setJdbcTypeInt(int jdbcTypeInt) {
        this.mybatisTypeName = MysqlTypeEnum.getMybatisName(jdbcTypeInt);
        this.jdbcTypeInt = jdbcTypeInt;
    }

    public int getIsNullable() {
        return isNullable;
    }

    public void setIsNullable(int isNullable) {
        this.isNullable = isNullable;
    }
}
